<?php

namespace app\admin\validate;

use app\admin\model\Menu;
use think\Validate;

class AuthForm extends Validate
{
    protected $rule = [

    'parent_id|上级菜单'  =>  'require|number|max:11',
    'name|菜单名' =>  'require|max:40',
    'router_url|前台菜单' =>  'require|max:60|/^[\w+\/]+$/',
    'back_router|后台菜单' =>  'require|max:60|/^[\w+\/]+$/',
    'icon|图标' =>'require',
    'list_order|排序' =>'number',
];
    public function addForm($data){
        $Menu  = new Menu();
        if($Menu->add($data)){
            return ['code'=>0,'msg'=>'添加成功!'];
        }else{
            return ['code'=>20011,'msg'=>'添加失败!'];
        }
    }


}